/*
 * BugetModifier.h
 *
 *  Created on: 2013-2-5
 *      Author: Dspark
 */

#ifndef BUGETMODIFIER_H_
#define BUGETMODIFIER_H_

#include "component/DynamicPie.h"
#include <qsplitter.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qstandarditemmodel.h>
#include <qtableview.h>
#include <qlineedit.h>
#include <qtextedit.h>
#include <qpushbutton.h>
#include "BugetItemDialog.h"
#include "../bo/Buget.h"
#include "../utile/DAObject.h"

class BugetModifier : public QWidget{
	Q_OBJECT
public:
	BugetModifier(User& u, quint32 bid);
	virtual ~BugetModifier();
Q_SIGNALS:
	void sig_succeed();
protected Q_SLOTS:
	void slt_addItem();
	void slt_itemAdded(BugetItem* item, bool conbine);
	void slt_modifyItem();
	void slt_itemUpdate(BugetItem* item);
	void slt_deleteItem();
	void slt_save();
protected:
	void loadData();
	void initUI();
	void renderTab();
	void updateLabels();
	bool isInvalid();
	User& user;
	quint32 bid;
	quint32 pid;
	QVBoxLayout layout;
	QSplitter pies;
	SolidPie totalPie;
	DynamicPie bugetPie;
	QLabel lab_total,lab_buget;
	QString projectName;
	qreal total,buget,paid;

	QGridLayout grid;
	QLabel lab_oa, lab_comment, lab_totalMade, lab_viewComment;
	QLineEdit oa;
	QTableView tab;
	QStandardItemModel tabModel;
	QTextEdit comment,viewComment;
	QPushButton bt_add,bt_modify,bt_delete,bt_submit;
	QList<BugetItem*> bugetItems;
	Buget::Status status;
};

#endif /* BUGETMODIFIER_H_ */
